# coding : UTF-8
import threading
import re
import time
import urllib
import urllib.request
import string

res_a = 0
res_b = 0
res_c = 0

def get_html_text(url):
    headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:23.0) Gecko/20100101 Firefox/23.0'}
    request = urllib.request.Request(url=url, headers=headers)
    html = urllib.request.urlopen(request).read()

    html = html.decode('utf-8')

    global res_a
    global res_b
    global res_c

    ret1 = re.findall(re.compile(r'id="gz_gszzl">(.+?)%</span>'), html)

    if float(ret1[0]) > 0:
        res_a += 1
    elif float(ret1[0]) == 0:
        res_b += 1
    else:
        res_c += 1
    print("正[%d]" %res_a , end=" ")
    print("平[%d]" %res_b , end=" ")
    print("负[%d]" %res_c)

if __name__ == '__main__':
    for i in range(0, 999999):#[110022,1542,968010]:#
        try:
            get_html_text("http://fund.eastmoney.com/%06d.html" %i)
        except Exception as e:
            continue